import requests from "./request";
import mockRequests from "./mockRequest";

export const reqCategoryList = () => requests({url: 'product/getBaseCategoryList', method: 'get'});
export const reqBannerList = () => mockRequests({url: '/banner',method: 'get' });
export const reqFloorList =  () => mockRequests({url: '/floor', method: 'get'});
export const reqSearchList = (data) => requests({url: '/list', method: 'post', data})
export const reqDetailList = (goodId) => requests({url: `/item/${goodId}`, method:'get'});
export const reqAddCart = (skuId, skuNum) => 
requests({
    url: `/cart/addToCart/${skuId}/${skuNum}`,
    method: 'post', 
});
export const reqCartList = () => requests({url: '/cart/cartList', method:'get'});
export const reqChangeShopCart = (skuId, skuNum) => requests({url: `/cart/addToCart/${skuId}/${skuNum}`, method:'post'});
export const reqChangeSkuSel = (skuId, isChecked) => requests({url: `/cart/checkCart/${skuId}/${isChecked}`, method:'get'});

export const reqDelsku = (skuId) => requests({url: `/cart/deleteCart/${skuId}`, method: 'DELETE'});

//获取验证码
export const reqCode = (phone) => requests({url: `/user/passport/sendCode/${phone}`, method: 'get'});
// 注册用户
export const reqRegister = (data) => requests({
    url: '/user/passport/register', 
    data,
    method:'post'});

//登录的接口:请求体携带参数 phone&&password
export const reqUserLogin = (data)=>requests({url:`/user/passport/login`,method:'post',data});

//获取用户登录成功以后用户信息的接口
export const reqUserInfo = ()=>requests({url:`/user/passport/auth/getUserInfo`,method:'get'});

// 退出登录
export const reqLogout = () => requests({url: '/user/passport/logout', method: 'get'});

export const reqTrade = () => requests({url: '/order/auth/trade', method: 'get'});

//提交订单接口
export const reqSubmitOrder = (tradeNo,data)=>requests({url:`/order/auth/submitOrder?tradeNo=${tradeNo}`,method:'post',data});

// 获取订单支付信息
export const reqPayInfo = (orderId) => requests({url: `/payment/weixin/createNative/${orderId}`, method:'get'});

// 得到订单状态
export const reqPayState = (orderId) => requests({url: `/payment/weixin/queryPayStatus/${orderId}`, method:'get'});

//获取我的订单
export const reqMyOrderList = (page,limit)=>requests({url:`/order/auth/${page}/${limit}`,method:'get'});